package cn.lzm.feignclient;

import cn.lzm.domain.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeignClient> {
    @Override
    public UserFeignClient create(Throwable throwable) {
        return new UserFeignClient() {
            @Override
            public User getUserById(Long id) {
                return new User(1L,"熔断了","网络繁忙，请稍后重试");
            }
        };
    }
}
